import vue from '@vitejs/plugin-vue'
import { defineConfig } from 'vite'
import {resolve} from 'path'

export default defineConfig({
  resolve: {
    alias: {
        "@": resolve(__dirname, 'src'), // 路径别名
    },
    extensions: ['.js', '.vue', '.json', '.ts'] // 使用路径别名时想要省略的后缀名，可以自己 增减
  },
  build: {
    outDir: '../dist',
    lib: {
      entry: './columns-editor.js',
      name: 'GTableColumnsEditor',
      fileName: (format) => `g-table-columns-editor.${format}.js`
    },
    rollupOptions: {
      external: ['vue', 'element-plus', 'axios'],
      output: {
        globals: {
          vue: 'Vue',
          'element-plus': 'ElementPlus',
          axios: 'axios'
        }
      }
    }
  },
  plugins: [vue()]
})